/*
补充时间奖励：
const timeBonus = 10; // 每秒奖励10分
const elapsedTime = timeLimit - remainingTime;
const timeReward = remainingTime * timeBonus;
*/

const pairsCleared = 20; // 假设玩家消除了20对卡片
const timeLimit = 300; // 游戏时间限制为300秒
const elapsedTime = 200; // 玩家实际用时200秒
const remainingTime = timeLimit - elapsedTime;
const timeBonus = 10; // 每秒奖励10分

// 计算基础分数
const baseScore = pairsCleared * 2;

// 计算时间奖励
const timeReward = remainingTime * timeBonus;

// 计算总分数
const totalScore = baseScore + timeReward;

console.log(`Total Score: ${totalScore}`);

// 玩家数据
const players = [
  { name: 'Player1', score: totalScore },
  { name: 'Player2', score: 120 },
  { name: 'Player3', score: 90 }
];

// 排名
players.sort((a, b) => b.score - a.score);

console.log('Ranking:');
players.forEach((player, index) => {
  console.log(`${index + 1}. ${player.name}: ${player.score}`);
});